wayland: Ignore NoSymbol keys
authorDaniel Stone <daniels@collabora.com>
Wed, 27 Apr 2016 12:06:38 +0000 (14:06 +0200)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 27 Apr 2016 13:00:30 +0000 (14:00 +0100)
NoSymbol is not a valid GDK symbol (it only has the concept of
VoidSymbol, for some reason, which is neither the same thing nor
produced by any sane keymap). Passing NoSymbol events through to GTK+
apps is unlikely to produce anything useful.

In particular, this meant VTE would scroll to the end of the buffer when
pressing Fn (required for Page Up/Down on Macs), as it was receiving a
keypress that wasn't a modifeir. This does not happen on X11, as the
KEY_FN keycode is above 255, so does not get sent to clients.

https://bugzilla.gnome.org/show_bug.cgi?id=764825

gdk/wayland/gdkdevice-wayland.c
gdk/wayland/gdkkeys-wayland.c

index 8d0a61e0997ca932d01cd5b68a2a0ed0adae20a5..ae564ab966142b479653f756d0af75bba58341fc 100644 (file)
@@ -1827,6 +1827,8 @@ deliver_key_event (GdkWaylandSeat *seat,
   xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (keymap);
 
   sym = xkb_state_key_get_one_sym (xkb_state, key);
+  if (sym == XKB_KEY_NoSymbol)
+    return;
 
   seat->pointer_info.time = time_;
   seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
index a780e9d9c2672573e0e581d95d0f15b50938abb2..01cdd0438325b3a488b5513cb67f464e43929760 100644 (file)
@@ -354,7 +354,7 @@ gdk_wayland_keymap_translate_keyboard_state (GdkKeymap       *keymap,
   if (consumed_modifiers)
     *consumed_modifiers = get_gdk_modifiers (xkb_keymap, consumed);
 
-  return TRUE;
+  return (sym != XKB_KEY_NoSymbol);
 }
 
 static guint